<template>
  <the-table :columns="columns" uri="/g/sells">
    <span slot="action" slot-scope="{ row }" v-if="row.state == 'pending'">
      <a class="ant-dropdown-link" @click="$emit('review', row)"
        ><a-icon type="edit" /> 审核
      </a>
    </span>
  </the-table>
</template>
<script>
import theTable from '@/components/theTable.vue'

const columns = [
  {
    title: '系统订单号',
    dataIndex: 'sys_id',
  },
  {
    title: '用户名',
    dataIndex: 'member.user.username',
    searchAble: true,
  },
  {
    title: '出币值',
    dataIndex: 'coins',
  },

  {
    title: '银行',
    dataIndex: 'member.bank',
    width: 120,
  },
  {
    title: '银行卡',
    dataIndex: 'member.bankcard',
  },
  {
    title: '开户人',
    dataIndex: 'member.realname',
    width: 80,
  },
  {
    title: '提交时间',
    dataIndex: 'created_at',
  },
  {
    title: '接单时间',
    dataIndex: 'took_at',
  },
  {
    title: '完成时间',
    dataIndex: 'done_at',
  },
  {
    title: '状态',
    dataIndex: 'state',
    dataType: 'select',
    searchAble: true,
    search: {
      selectOptions: [
        { title: '待审', value: 'pending' },
        { title: '已通过', value: 'pass' },
        // { title: '已拒绝', value: 'reject' },
        { title: '已接单', value: 'took' },
        { title: '已完成', value: 'done' },
        { title: '已取消', value: 'canceled' },
      ],
    },
    width: 80,
    customRender: (val) => {
      const map = new Map([
        ['pending', '待审'],
        ['pass', '已通过'],
        ['reject', '已拒绝'],
        ['took', '已接单'],
        ['done', '已完成'],
        ['canceled', '已取消'],
      ])
      return map.get(val)
    },
  },
  //   {
  //     title: '操作',
  //     key: 'action',
  //     scopedSlots: { customRender: 'action' },
  //     width: 80,
  //   },
]

export default {
  components: { theTable },

  data() {
    return {
      columns,
    }
  },
  mounted() {},
  methods: {},
}
</script>
